package com.fist.eth.flutter_plugin_eth_wallet.utils

class TokenManager private constructor() {
    private var mWallet: TokenWallet? = null
    private var mContract: TokenContract? = null

    companion object {
        @Volatile
        private var mInstance: TokenManager? = null

        val instance: TokenManager
            get() {
                if (mInstance == null) {
                    synchronized(TokenManager::class.java) {
                        if (mInstance == null) {
                            mInstance = TokenManager()
                        }
                    }
                }
                return mInstance!!
            }
    }

    fun setWallet(tokenWallet: TokenWallet) {
        mWallet = tokenWallet
    }

    val wallet: TokenWallet? get() = mWallet

    fun setContract(contract: TokenContract) {
        mContract = contract
    }

    val contract: TokenContract? get() = mContract
}